home *** CD-ROM | disk | FTP | other *** search
/ Joystick Magazine 1996 May / cd joy 71No13.iso / pc / demos / eurosoc / source / jimlib.h < prev    next >
Text File  |  1995-09-18  |  3KB  |  109 lines

  1. #ifndef _JIMLIB_H
  2.  
  3. #define _JIMLIB_H
  4.  
  5. // Structure for holding the palette
  6. typedef struct
  7. {
  8.     unsigned char r;                             // RGB values for palette 
  9.     unsigned char g;                             // From 0 to 63
  10.     unsigned char b;                                        // (Or 256 from DPaint) 
  11. } rgb;
  12.  
  13. // Structure used for real mode interrupts
  14. struct rminfo
  15. {
  16.     long EDI;
  17.     long ESI;
  18.     long EBP;
  19.     long reserved;
  20.     long EBX;
  21.     long EDX;
  22.     long ECX;
  23.     long EAX;
  24.     short flags;
  25.     short ES,DS,FS,GS,IP,CS,SP,SS;
  26. };
  27.  
  28. // Structure for holding mouse status
  29. typedef struct
  30. {
  31.     short    x,y,b;
  32. } mouse_struct;
  33.  
  34. typedef unsigned char u_char;
  35. typedef unsigned short u_short;
  36. typedef unsigned long u_long;
  37.  
  38. // Prototypes for functions within jimlib.asm
  39. void UpdatePalette(rgb *Buffer);
  40. void SetPalette(unsigned char reg, unsigned char r, unsigned char g, unsigned char b);
  41. unsigned short SetVideoMode(unsigned short mode);
  42. unsigned short SSetVideoMode(unsigned short mode);
  43. void SSetVideoBank(unsigned short mode);
  44. void SSetVideoBankR(unsigned short mode);
  45. void WaitVBlank(void);
  46. void ClearVBanks(unsigned char banks);
  47. unsigned short MouseClick(void);
  48. void LongCopy(unsigned char *, unsigned char *, unsigned short);
  49. void LongSet(unsigned char *, unsigned long, unsigned length);
  50. #include "E:\jimlib\jimfunc.h"
  51.                            
  52. // DOS Text attributes
  53. #define DOS_BLINK     128
  54. #define DOS_INVERSE   119
  55. #define DOS_BRIGHT    8
  56. #define DOS_UNDERLINE 1
  57.  
  58. typedef enum
  59. {
  60.     DOS_BLACK,
  61.     DOS_BLUE,
  62.     DOS_GREEN,
  63.     DOS_CYAN,
  64.     DOS_RED,
  65.     DOS_MAGENTA,
  66.     DOS_BROWN,
  67.     DOS_WHITE,
  68.     DOS_GREY,
  69.     DOS_LT_BLUE,
  70.     DOS_LT_GREEN,
  71.     DOS_LT_CYAN,
  72.     DOS_LT_RED,
  73.     DOS_LT_MAGENTA,
  74.     DOS_YELLOW,
  75.     DOS_BRIGHT_WHITE
  76. } dos_colours;
  77.  
  78. // Some useful macros
  79. #define SCROLL_UP   6
  80. #define SCROLL_DOWN 7
  81. #define limitRange(x,l,u) x=((x)<(l))?(l):((x)>(u))?(u):(x)
  82. #define diff(x1,x2) (((x1)>(x2))?((x1)-(x2)):((x2)-(x1)))
  83. #define JIM_SEG(_ptr) (((int)(_ptr))>>4)
  84. #define JIM_OFF(_ptr) (((int)(_ptr))&0xF)
  85. #define JIM_PTR(_seg,_off) ((((int)(_seg))<<4)+((int)(_off)))
  86. #define clear(x) memset(&x,0,sizeof(x))
  87. #define save_cursor() cursor_position_routine(0)
  88. #define restore_cursor() cursor_position_routine(1)
  89. #define WORD68(x) ( ((x&0x00ff)<<8) + (x>>8) )
  90. #define LONG68(x) ( ((x&0x000000ff)<<24) + ((x&0x0000ff00)<<8)+((x&0x00ff0000)>>8)+(x>>24))
  91.  
  92. // ADPCM stuff for playstation
  93. #define SUB_FORM1  (0)
  94. #define SUB_FORM2  (1<<5)
  95. #define SUB_AUDIO  (1<<2)
  96. #define SUB_DATA   (1<<3)
  97. #define SUB_RT     (1<<6)
  98. #define SUB_EOF    (1<<7 | 1<<0)
  99. #define SUB_STEREO (1<<0)
  100. #define SUB_ADPCMC (1<<2)
  101.  
  102. #ifndef VGA_SCREEN
  103. #define VGA_SCREEN ((unsigned char *)0xa0000)
  104. #endif
  105.  
  106. #define DOS_SCREEN ((unsigned short *)0xb8000)
  107.  
  108. #endif /* _JIMLIB_H */
  109.